<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
		body, html, {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
				#l-map{height:500px;width:100%;}
				#r-result{width:100%;}
	</style>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=vLrGTjXqAnspe5DWanhQIcuV3XEZr3s7"></script>
	<title>根据城市名设置地图中心点</title>
</head>
<body>
	<div id="l-map"></div>
	<div id="r-result"></div>
</body>
</html>
<script type="text/javascript">
	// 百度地图API功能
	var map = new BMap.Map("l-map");  // 创建Map实例
	var mPoint = new BMap.Point(104.075511, 30.663797);
	map.enableScrollWheelZoom();
	map.centerAndZoom(mPoint,15);
	// var geolocation = new BMap.Geolocation();
	// geolocation.getCurrentPosition(function(r){
	// 	if(this.getStatus() == BMAP_STATUS_SUCCESS){
	// 		var mk = new BMap.Marker(r.point);
	// 		map.addOverlay(mk);
	// 		map.panTo(r.point);
	// 		// alert('您的位置：'+r.point.lng+','+r.point.lat);
	// 	}
	// 	else {
	// 		alert('failed'+this.getStatus());
	// 	}        
	// },{enableHighAccuracy: true})
	var circle = new BMap.Circle(mPoint,1000,{fillColor:"blue", strokeWeight: 1 ,fillOpacity: 0.3, strokeOpacity: 0.3});
	map.addOverlay(circle);
	var local =  new BMap.LocalSearch(map, {renderOptions: {map: map, panel: "r-result"}});  
	local.searchNearby('停车场',mPoint,1000);
</script>